package org.fintan.make.utils;

import java.util.Date;

import org.apache.commons.lang.time.DateFormatUtils;

public class DateUtil {

	
	public final static String DATE_FORMAT_PATTERN = "yyyy-MM-dd";

	public final static String DATE_TIME_FORMAT_PATTERN = "yyyy-MM-dd HH:mm:ss";

	public final static String DATE_FORMAT_CN_PATTERN = "yyyy年MM月dd日";
	
	public final static String DATE_FORMAT_NANOSECODS_PATTERN = "yyyyMMddHHmmssSSS";

	public final static String[] DATE_PARSE_PATTERNS = { DATE_FORMAT_PATTERN, DATE_TIME_FORMAT_PATTERN,
			DATE_FORMAT_CN_PATTERN, "yyyy-M-dd", "yyyy-M-d" };

	public final static String getDateString(Date date) {
		return DateFormatUtils.format(date, DATE_FORMAT_PATTERN);
	}
	
	
	public final static String date2Nanoseconds(Date date) {
		return DateFormatUtils.format(date, DATE_FORMAT_NANOSECODS_PATTERN);
	}
	
	public final static String getDate(Date date) {
		return DateFormatUtils.format(date, DATE_TIME_FORMAT_PATTERN);
	}
}
